home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / ShareMailGiftware / WHDload_Paket / WHDload_Demos / MelonDezign_PlanetM.lha / PlanetMHD / Install next >
Text File  |  2002-04-28  |  9KB  |  322 lines

  1. ;****************************
  2.  
  3. (set #readme-file "ReadMe")        ;name of readme file
  4. (set #man-file "Manual")        ;name of manual file
  5. (set #hint-file "Hints")        ;name of hint file
  6. (set #sol-file "Solution")        ;name of solution file
  7. (set #highs-file "highs")        ;name of high scores file
  8. (set #prefix @app-name)            ;name of slave, directory
  9.  
  10. (procedure P_MakeImages
  11.  
  12.   ;the following lines must be copied and adjusted for multiple disk images
  13.  
  14.   (set #CI_disknum 1)
  15.   (set #CI_diskname ("%s Disk %ld" @app-name #CI_disknum))
  16.   (set #CI_disklen 901120)
  17.   (set #CI_skiptrk "")
  18.   (P_CreateImage)
  19.  
  20.   ;for example...
  21.   ;(set #CI_disknum 2)
  22.   ;(set #CI_diskname ("%s Disk %ld" @app-name #CI_disknum))
  23.   ;(P_CreateImage)
  24.  
  25. )
  26.  
  27. ;****************************
  28. ;----------------------------
  29. ; checks if given program is installed, if not abort install
  30. ; #program - to check
  31.  
  32. (procedure P_ChkRun
  33.   (if (= 0 (run ("cd SYS:\nWhich %s >NIL:" #program)))
  34.     ("")
  35.     (abort
  36.       (cat
  37.     "You must install \"" #program "\" first!\n"
  38.     "It must be accessible via the path.\n"
  39.     "You can find it in the WHDLoad package."
  40.       )
  41.     )
  42.   )
  43. )
  44.  
  45. ;----------------------------
  46. ; Create Image using DIC
  47. ; #dest        - path to save image in
  48. ; #CI_disknum  - number of the disk image to create
  49. ; #CI_diskname - label of the disk
  50. ; #CI_disklen  - length of disk image to create
  51. ; #CI_skiptrk  - track to skip, -1 means no skip
  52. ; #CI_drive    - drive to create image from
  53.  
  54. (procedure P_CreateImage
  55.   (message
  56.     (cat
  57.     "\nInsert \"" #CI_diskname "\" into drive " #CI_drive "!\n\n"
  58.     "(make sure it's the right disk because it will not be checked)"
  59.     )
  60.   )
  61.   (if (= #CI_skiptrk "")
  62.     (set #option "")
  63.     (set #option (cat " SKIPTRACK=" #CI_skiptrk))
  64.   )
  65.   (if
  66.     (= 0
  67.       (run
  68.         (cat
  69.           "cd \"" #dest "\"\n"
  70.           "DIC " #CI_drive " FD=" #CI_disknum " LD=" #CI_disknum " SIZE="
  71.           #CI_disklen #option " PEDANTIC >CON:///1000//CLOSE"
  72.         )
  73.       )
  74.     )
  75.     (run ("FileNote \"%s.%ld\" \"%s\" Quiet" (tackon #dest "disk") #CI_disknum @app-name))
  76.     (abort "\"DIC\" has failed to create a diskimage")
  77.   )
  78. )
  79.  
  80. ;----------------------------
  81. ; copy file including icon if exist
  82. ; #copy-file - name of file to copy
  83.  
  84. (procedure P_CopyFile
  85.   (if (exists #copy-file) (
  86.     (copyfiles
  87.       (help @copyfiles-help)
  88.       (source #copy-file)
  89.       (dest #dest)
  90.     )
  91.     (if (exists ("%s.info" #copy-file)) (
  92.       (copyfiles
  93.         (help @copyfiles-help)
  94.         (source ("%s.info" #copy-file))
  95.         (dest #dest)
  96.       )
  97.       (tooltype
  98.         (dest (tackon #dest #copy-file))
  99.         (noposition)
  100.       )
  101.     ))
  102.   ))
  103. )
  104.  
  105. ;****************************
  106.  
  107. (if (< @installer-version (+ (* 44 65536) 10))
  108.   (
  109.     (message
  110.       (cat
  111.         "Warning: your installer is outdated.\n"
  112.         "Some features of this installation won't be available, "
  113.         "such as icon show and drawer opening. "
  114.         "You have version " (/ @installer-version 65536) "." 
  115.         (BITAND @installer-version 65535) ", recommended is version 44.10. "
  116.         "The 'installer' 44.10 comes with OS 3.5 but is also contained in the NDK 3.9. "
  117.         "You may also use the InstallerNG by Jens Tröger."
  118.         "\n\n"
  119.         "The installers can be obtained from the net:\n"
  120.         "http://www.amiga.com/3.9/download/NDK3.9.lha\n"
  121.         "aminet:util/sys/InstallerNG.lha"
  122.       )
  123.     )
  124.     (set #newstuff 0)
  125.   )
  126.   (set #newstuff 1)
  127. )
  128.  
  129. (if (exists #readme-file)
  130.   (if (= 0 (run ("SYS:Utilities/Multiview %s" #readme-file)))
  131.     ("")
  132.     (run ("SYS:Utilities/More %s" #readme-file))
  133.   )
  134. )
  135.  
  136. (set #program "WHDLoad")
  137. (P_ChkRun)
  138.  
  139. (set #program "DIC")
  140. (P_ChkRun)
  141.  
  142. (if (= @user-level 2)
  143.   (
  144.     (set #CI_drive
  145.       (askchoice
  146.     (prompt "Select source drive for diskimages")
  147.     (default 0)
  148.     (choices "DF0:" "DF1:" "RAD:" "Enter Device")
  149.     (help @askchoice-help)
  150.       )
  151.     )
  152.     (select #CI_drive
  153.       (set #CI_drive "DF0:")
  154.       (set #CI_drive "DF1:")
  155.       (set #CI_drive "RAD:")
  156.       (set #CI_drive
  157.         (askstring
  158.           (prompt "Select source drive for diskimages")
  159.           (default "DF0:")
  160.           (help @askstring-help)
  161.         )
  162.       )
  163.     )
  164.   )
  165.   (set #CI_drive "DF0:")
  166. )
  167.  
  168. (if (getenv "WHDLInstPath")
  169.   (set @default-dest (getenv "WHDLInstPath"))
  170. )
  171. (set #dest
  172.   (askdir
  173.     (prompt
  174.       (cat
  175.     "Where should \"" @app-name "\" be installed?\n"
  176.     "A drawer \"" #prefix "\" will be automatically created."
  177.       )
  178.     )
  179.     (help @askdir-help)
  180.     (default @default-dest)
  181.   )
  182. )
  183. (run ("setenv WHDLInstPath \"%s\"\ncopy ENV:WHDLInstPath ENVARC:" #dest))
  184. (set #dest (tackon #dest #prefix))
  185. (if (exists #dest) (
  186.   (set #choice
  187.     (askbool
  188.       (prompt
  189.         (cat
  190.           "\nDirectory \"" #dest "\" already exists.\n"
  191.           "Should it be deleted?"
  192.         )
  193.       )
  194.       (default 1)
  195.       (choices "Delete" "Skip")
  196.       (help @askbool-help)
  197.     )
  198.   )
  199.   (if (= #choice 1)
  200.     (delete #dest
  201.       (help @delete-help)
  202.       (all)
  203.     )
  204.   )
  205. ))
  206. (makedir #dest
  207.   (help @makedir-help)
  208.   (infos)
  209. )
  210.  
  211. ;----------------------------
  212.  
  213. (copyfiles
  214.   (help @copyfiles-help)
  215.   (source ("%s.Slave" #prefix))
  216.   (dest #dest)
  217. )
  218. (if (exists ("%s.glowexot"  #prefix)) ((set #icon 7)(set #icnt (+ 1 #icnt))(set #icon-gex "Exotic GlowIcon")) (set #icon-gex ""))
  219. (if (exists ("%s.newexot"   #prefix)) ((set #icon 6)(set #icnt (+ 1 #icnt))(set #icon-nex "Exotic NewIcon"))  (set #icon-nex ""))
  220. (if (exists ("%s.exoticon"  #prefix)) ((set #icon 5)(set #icnt (+ 1 #icnt))(set #icon-exo "Exoticon"))        (set #icon-exo ""))
  221. (if (exists ("%s.glowicon"  #prefix)) ((set #icon 4)(set #icnt (+ 1 #icnt))(set #icon-glo "Glow Icon"))       (set #icon-glo ""))
  222. (if (exists ("%s.coloricon" #prefix)) ((set #icon 3)(set #icnt (+ 1 #icnt))(set #icon-col "OS3.5 Icon"))      (set #icon-col ""))
  223. (if (exists ("%s.newicon"   #prefix)) ((set #icon 2)(set #icnt (+ 1 #icnt))(set #icon-new "NewIcon"))         (set #icon-new ""))
  224. (if (exists ("%s.romicon"   #prefix)) ((set #icon 1)(set #icnt (+ 1 #icnt))(set #icon-rom "RomIcon"))         (set #icon-rom ""))
  225. (if (exists ("%s.inf"       #prefix)) ((set #icon 0)(set #icnt (+ 1 #icnt))(set #icon-nor "Normal"))          (set #icon-nor ""))
  226. (procedure P_Icon
  227.   (copyfiles
  228.     (help @copyfiles-help)
  229.     (source ("%s.%s" #prefix #icon-suf))
  230.     (newname ("%s.info" #icon-name))
  231.     (dest #icon-dir)
  232.   )
  233.   (tooltype
  234.     (dest (tackon #icon-dir #icon-name))
  235.     (noposition)
  236.   )
  237. )
  238. (if (> #icnt 1) (
  239.   (if (= #newstuff 1) (
  240.     (set #icon-dir ("T:%s Icons" #prefix))
  241.     (makedir #icon-dir
  242.       (help @makedir-help)
  243.     )
  244.     (if #icon-nor ((set #icon-suf "inf")      (set #icon-name "Normal")          (P_Icon)))
  245.     (if #icon-rom ((set #icon-suf "romicon")  (set #icon-name "RomIcon")         (P_Icon)))
  246.     (if #icon-new ((set #icon-suf "newicon")  (set #icon-name "NewIcon")         (P_Icon)))
  247.     (if #icon-col ((set #icon-suf "coloricon")(set #icon-name "OS3.5 Icon")      (P_Icon)))
  248.     (if #icon-glo ((set #icon-suf "glowicon") (set #icon-name "Glow Icon")       (P_Icon)))
  249.     (if #icon-exo ((set #icon-suf "exoticon") (set #icon-name "Exoticon")        (P_Icon)))
  250.     (if #icon-nex ((set #icon-suf "newexot")  (set #icon-name "Exotic NewIcon")  (P_Icon)))
  251.     (if #icon-gex ((set #icon-suf "glowexot") (set #icon-name "Exotic GlowIcon") (P_Icon)))
  252.     (openwbobject #icon-dir)
  253.   ))
  254.   (set #icon
  255.     (askchoice
  256.       (prompt "\nWhich icon would you like to install?\n")
  257.       (choices #icon-nor #icon-rom #icon-new #icon-col #icon-glo #icon-exo #icon-nex #icon-gex)
  258.       (default #icon)
  259.       (help @askchoice-help)
  260.     )
  261.   )
  262.   (if (= #newstuff 1) (
  263.     (closewbobject #icon-dir)
  264.     (delete #icon-dir
  265.       (help @delete-help)
  266.       (all)
  267.     )
  268.   ))
  269. ))
  270. (select #icon
  271.   (set #icon "inf")
  272.   (set #icon "romicon")
  273.   (set #icon "newicon")
  274.   (set #icon "coloricon")
  275.   (set #icon "glowicon")
  276.   (set #icon "exoticon")
  277.   (set #icon "newexot")
  278.   (set #icon "glowexot")
  279. )
  280. (copyfiles
  281.   (help @copyfiles-help)
  282.   (source ("%s.%s" #prefix #icon))
  283.   (newname ("%s.info" #prefix))
  284.   (dest #dest)
  285. )
  286. (if (= #icon "newicon")
  287.   ("")
  288.   (
  289.     (tooltype
  290.       (dest (tackon #dest #prefix))
  291.       (settooltype "Slave")
  292.       (settooltype "PreLoad")
  293.     )
  294.     (tooltype
  295.       (dest (tackon #dest #prefix))
  296.       (settooltype "PreLoad" "")
  297.       (settooltype "Slave" ("%s.Slave" #prefix))
  298.     )
  299.   )
  300. )
  301. (tooltype
  302.   (dest (tackon #dest #prefix))
  303.   (setdefaulttool "WHDLoad")
  304.   (setstack 10240)
  305.   (noposition)
  306. )
  307. (set #copy-file #readme-file)
  308. (P_CopyFile)
  309. (set #copy-file #man-file)
  310. (P_CopyFile)
  311. (set #copy-file #hint-file)
  312. (P_CopyFile)
  313. (set #copy-file #sol-file)
  314. (P_CopyFile)
  315. (set #copy-file #highs-file)
  316. (P_CopyFile)
  317. (P_MakeImages)
  318. (if (= #newstuff 1)
  319.   (openwbobject #dest)
  320. )
  321. (exit)
  322.